from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
from postion import options
from postion import service

driver = webdriver.Chrome(options=options,service=service)
driver.get(r'https://www.baidu.com/')
driver.maximize_window()
driver.implicitly_wait(30)# 隐式等待，单位为秒
sleep(3)

driver.find_element(By.ID,'kw').send_keys('a6')
# 针对百度按钮进行显式等待
su_loc=(By.ID,'su')
ele=WebDriverWait(driver,30,0.5).until(EC.visibility_of_element_located(su_loc))# 是否可见
ele.click()
sleep(3)  # 死等

driver.quit()
